Skip to content

feat: add PVC and StorageClass backend API endpoints#905

Merged
google-oss-prow[bot] merged 5 commits intokubeflow:notebooks-v2from
andyatmiami:feat/pvc-related-endpoints
Mar 8, 2026
Merged

feat: add PVC and StorageClass backend API endpoints#905
google-oss-prow[bot] merged 5 commits intokubeflow:notebooks-v2from
andyatmiami:feat/pvc-related-endpoints

Conversation

@andyatmiami
Copy link
Contributor

closes: #634
closes: #693
closes: #849

Implements List, Create, and Delete endpoints for PersistentVolumeClaims and a List endpoint for StorageClasses in the backend API.

PVC List endpoint includes cross-references to:

  • Bound PersistentVolume (with StorageClass metadata)
  • Pods that mount the PVC
  • Workspaces that reference the PVC (via home or data volumes)

Cross-reference collections (pods, workspaces) always serialize as empty arrays [] rather than being omitted, matching the pattern used by services and data on WorkspaceListItem. The pv field uses omitempty and is omitted when the PVC is unbound.

Pod and Workspace cross-references use a list-once-and-map approach (single List call per resource type, then in-memory lookup) rather than per-PVC queries, since Kubernetes does not support field selectors for filtering pods by PVC claim name.

Notable:

  • RBAC includes persistentvolumes (get/list/watch) in addition to persistentvolumeclaims, since bound PV metadata is resolved for each PVC in the list response.
  • PVC Create returns an empty Location header because there is no GET-by-name endpoint for PVCs (only list by namespace).
  • PVC sentinel errors use errors.New instead of fmt.Errorf (without format verbs), aligning with the workspacekinds repository pattern rather than the workspaces/secrets pattern.
  • Sample manifests (PVCs, Secret) now include can-mount and can-update labels so resources created outside the API render correctly in list responses.

@github-project-automation github-project-automation bot moved this to Needs Triage in Kubeflow Notebooks Feb 14, 2026
@google-oss-prow google-oss-prow bot added area/backend area - related to backend components area/controller area - related to controller components area/v2 area - version - kubeflow notebooks v2 labels Feb 14, 2026
@andyatmiami
Copy link
Contributor Author

/ok-to-test

Implements List, Create, and Delete endpoints for PersistentVolumeClaims
and a List endpoint for StorageClasses in the backend API.

PVC List endpoint includes cross-references to:
- Bound PersistentVolume (with StorageClass metadata)
- Pods that mount the PVC
- Workspaces that reference the PVC (via home or data volumes)

Cross-reference collections (pods, workspaces) always serialize as empty
arrays `[]` rather than being omitted, matching the pattern used by
`services` and `data` on WorkspaceListItem. The `pv` field uses
`omitempty` and is omitted when the PVC is unbound.

Pod and Workspace cross-references use a list-once-and-map approach
(single List call per resource type, then in-memory lookup) rather than
per-PVC queries, since Kubernetes does not support field selectors for
filtering pods by PVC claim name.

Notable:
- RBAC includes `persistentvolumes` (get/list/watch) in addition to
  `persistentvolumeclaims`, since bound PV metadata is resolved for
  each PVC in the list response.
- PVC Create returns an empty Location header because there is no
  GET-by-name endpoint for PVCs (only list by namespace).
- PVC sentinel errors use `errors.New` instead of `fmt.Errorf` (without
  format verbs), aligning with the workspacekinds repository pattern
  rather than the workspaces/secrets pattern.
- Sample manifests (PVCs, Secret) now include `can-mount` and
  `can-update` labels so resources created outside the API render
  correctly in list responses.

Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
@andyatmiami andyatmiami force-pushed the feat/pvc-related-endpoints branch from e4269ef to 2cd172f Compare March 5, 2026 18:21
Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
@andyatmiami
Copy link
Contributor Author

verification via API testing

image image image image

@andyatmiami
Copy link
Contributor Author

/lgtm

testing PR with Mathew's contributions and confirm:

  • i am comfortable with the behavior introduced
  • code still is functionally correct (from live testing verification)

@google-oss-prow
Copy link

@andyatmiami: you cannot LGTM your own PR.

Details

In response to this:

/lgtm

testing PR with Mathew's contributions and confirm:

  • i am comfortable with the behavior introduced
  • code still is functionally correct (from live testing verification)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
@thesuperzapper
Copy link
Member

@andyatmiami as discussed I pushed some more changes in 5450955

Still need to fix up some tests which now fail because we are being more strict about PVC/StorageClasses existing when creating a Workspace/PVC.

- fixed tests to ensure all passing
- fixed reference to ensure we are using `pvc.Spec.StorageClassName` when getting pvcs
- added storageclass data prep to `setup-kind.sh` to facilitate better/more realistic local development

Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
@google-oss-prow google-oss-prow bot added the area/ci area - related to ci label Mar 8, 2026
@andyatmiami
Copy link
Contributor Author

@thesuperzapper

pulled your changes (thank you!) and fixed up tests and a few other usability issues...

your changes /lgtm and i think we can finally move forward with merging this 💯

@thesuperzapper
Copy link
Member

Thanks, this is going to make us much closer to release of notebooks V2.

/lgtm
/approve

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: thesuperzapper

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 455b333 into kubeflow:notebooks-v2 Mar 8, 2026
12 of 14 checks passed
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in Kubeflow Notebooks Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved area/backend area - related to backend components area/ci area - related to ci area/controller area - related to controller components area/v2 area - version - kubeflow notebooks v2 lgtm ok-to-test size/XXL

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants